package com.jss.jssmybatisplus.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jss.jssmybatisplus.dto.ResultResponse;
import com.jss.jssmybatisplus.dto.req.QueryByPageReqDTO;
import com.jss.jssmybatisplus.dto.resp.OrderIndoRespDTO;
import com.jss.jssmybatisplus.service.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;


/**
 * 订单
 *
 * @author jss
 * @email 532935603@qq.com
 * @date 2022-08-23 15:20:40
 */
@RestController
@RequestMapping("jssmybatisplus/order")
public class OrderController {
    @Resource
    private OrderService orderService;

    @GetMapping("/getOrderInfo/{orderNumber}")
    public ResultResponse<OrderIndoRespDTO> getOrderInfo(@PathVariable("orderNumber") String orderNumber) {
        return orderService.getOrderInfo(orderNumber);
    }


    @PostMapping("/getOrderInfo/queryByPage")
    public ResultResponse<IPage<OrderIndoRespDTO>> queryByPage(@RequestBody @Valid QueryByPageReqDTO queryByPageReqDTO){
        return orderService.queryByPage(queryByPageReqDTO);
    }
}
